# coding:utf8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

import time

from flask import Blueprint
from flask import jsonify

from libapi import ApiDoc, ApiNode, cpts

bp_v2 = Blueprint("book", __name__, url_prefix="/v2/book")

print cpts.refs


@bp_v2.route("/<int:bookid>", endpoint="update_book", methods=["POST"])
@ApiDoc.api_doc(summary="update user account",
                description="update user account",
                tag="book 系统",
                resp=cpts.refs['OmConfig'],
                errors=[(400, cpts.refs['400Error'])],
                name=ApiNode("str", True),
                ip=ApiNode("str", False, limit=['1', '2', '3', '4']),
                address=ApiNode("str", False),
                userId=ApiNode("basestring", True, op_in=ApiDoc.OP_PATH, limit=(20, 40)),
                limit=ApiNode("int", False, op_in=ApiDoc.OP_BODY),
                offset=ApiNode("int", False, op_in=ApiDoc.OP_BODY)
                )
def update_book(bookid):
    response_map = {
        "errorCode": 200,
        "message": "成功",
        "serverTime": int(round(time.time() * 1000)),
        "data": [],
    }
    return jsonify(response_map)
